#ifndef __devinfo_h__
#define __devinfo_h__ 1
#include "cJSON.h"

#define DEV_TYPE_TV     "TV"

typedef struct{
    char ifname[16];
    char ip[32];
    char mac[32];
    char dev_type[16];//tv,onu,...
    int is_wifi;
    char mem[64];
    char cpu[64];
    char factory[64];
    char model[64];
    char sw_version[64];
    char osType[64];
    char osVersion[64];
    char upTime[64];
    char startUpTime[64];//开机时长
    char insertTime[64];
    char gatewaySN[128];
    char loid[64];
    char loidKey[64];
    int clientPattern;// 1:router, 2:bridge 
    int flashSize;
    int needUpdateSysTime, forbidCheckBackgroudFlow;
}DevInfo_t;

extern DevInfo_t devInfo;


// #define PRE_PPPOE_USER "tzwincg"
// #define PRE_PPPOE_PWD "y@I%Qjc"
// #define PRE_PPPOE_USER "08718223073"
// #define PRE_PPPOE_PWD "a123456"
#define PRE_PPPOE_USER "tzwincg"
#define PRE_PPPOE_PWD "tzwincg123"

void load_devinfo(DevInfo_t *devinfo);
cJSON* devinfo2cjson(DevInfo_t* devinfo, cJSON *root);
int devinfo_has_internet_r();
int devinfo_get_internet_r_usr_pwd(char *pppoe_usr, char *pppoe_pwd);
int devinfo_is_bridge();
void devinfo_del_pppoe_dial(char* usrname, char* pwd);
void devinfo_add_pppoe_dial(char* usrname, char* pwd);
void devinfo_update_systime(uint32_t sec);

int devinfo_monitor_net_rate(DevInfo_t* devinfo);


void get_os_version(char *buf);
extern void linux_get_devinfo(DevInfo_t*);
extern int isHiWIFI();

extern int is_hg261gs();
int hg261gs_is_bridge();
int hg261gs_has_internet();
int hg261gs_get_internet_r_pwd(char *usr, char *pwd);
extern void hg261gs_get_mac(char* mac);
extern void hg261gs_get_devinfo(DevInfo_t* devinfo);
void hg261gs_enable_mirror(DevInfo_t* devinfo);
void hg261gs_disable_mirror(DevInfo_t* devinfo);

extern int is_pt622g();
extern int pt622g_is_bridge();
int pt622g_has_internet();
int pt622g_get_internet_r_pwd(char *usr, char *pwd);
extern void pt622g_get_devinfo(DevInfo_t* devinfo);
extern void pt622g_get_mac(char* mac);


int is_TEWA500AG();
int TEWA500AG_is_bridge();
int TEWA500AG_has_internet();
void TEWA500AG_get_mac(char* mac);
void TEWA500AG_get_devinfo(DevInfo_t* devinfo);
int TEWA500AG_get_internet_r_pwd(char *usr, char *pwd);
#endif